//
// Created by liushuai on 2021/2/17.
//

#include "toHex.h"
string toHex(int num) {
<<<<<<< HEAD:cxx/algorithm/src/toHex.cc
    if(num==0)
        return "0";
    char chs[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
    string res;
    unsigned unum = num;
    while (unum){
        res = chs[unum&15]+res;
        unum = unum>>4;
    }
    return res;
=======
  if (num == 0) return "0";
  char chs[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
  string res;
  unsigned unum = num;
  while (unum) {
    res = chs[unum & 15] + res;
    unum = unum >> 4;
  }
  return res;
>>>>>>> dev:cxx/algorithm/common/src/toHex.cc
}